<?php
define('IN_QY',true);
require("include/common.inc.php");

//判断是否领取
	$sqlt = "SELECT * from tbl_tenred  where uid='".$_COOKIE['userid']."' ";
    $queryt=mysql_query($sqlt);
    $rowt=mysql_fetch_array($queryt);

if($rowt){
	
echo json_encode(array('data'=>$_COOKIE['userid'],'code'=>1)); 
exit;	
}


	$sql="INSERT INTO tbl_tenred 
	 VALUES(
	0,
	'".$_COOKIE['userid']."',
	'10.00',
	'".date("Y-m-d H:i:s")."'
	)";
	$uu=mysql_query($sql);


if($uu){
echo json_encode(array('data'=>$_COOKIE['userid'],'code'=>0)); 		
}
else{
echo json_encode(array('data'=>$_COOKIE['userid'],'code'=>2)); 	
}

?>